#!/bin/bash
echo VAL6,VAL8,VAL9,VALA,VAL11,VAL20,capacity,temp,voltage,current,TTE,TTF
DEVICE_BATT=/sys/class/power_supply/max1720x-6c-0

while [ 1 ]
do
    VAL6=$(i2cget -y -f 1 0x36 0x06 w)
    VAL8=$(i2cget -y -f 1 0x36 0x08 w)
    VAL9=$(i2cget -y -f 1 0x36 0x09 w)
    VALA=$(i2cget -y -f 1 0x36 0x0a w)
    VAL11=$(i2cget -y -f 1 0x36 0x11 w)
    VAL20=$(i2cget -y -f 1 0x36 0x20 w)

    capacity=$(cat $DEVICE_BATT/capacity)
    temp=$(cat $DEVICE_BATT/temp)
    voltage=$(cat $DEVICE_BATT/voltage_now)
    current=$(cat $DEVICE_BATT/current_now)
    TTE=$(cat $DEVICE_BATT/TTE)
    TTF=$(cat $DEVICE_BATT/TTF)
    
    echo $VAL6,$VAL8,$VAL9,$VALA,$VAL11,$VAL20,$capacity,$temp,$voltage,$current,$TTE,$TTF
    sleep 1
done


